IntRange

class IntRange(start: Int, endInclusive: Int) : IntProgression, ClosedRange<Int>

A range of values of type Int.

Constructors

IntRange
Link copied to clipboard
fun IntRange(start: Int, endInclusive: Int)

Types

Companion
Link copied to clipboard
object Companion

Functions

contains
Link copied to clipboard
open operator override fun contains(value: Int): Boolean
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open override fun hashCode(): Int
isEmpty
Link copied to clipboard
open override fun isEmpty(): Boolean

Checks whether the range is empty.

iterator
Link copied to clipboard
open operator override fun iterator(): IntIterator
toString
Link copied to clipboard
open override fun toString(): String

Properties

endInclusive
Link copied to clipboard
open override val endInclusive: Int
first
Link copied to clipboard
val first: Int
last
Link copied to clipboard
val last: Int
start
Link copied to clipboard
open override val start: Int
step
Link copied to clipboard
val step: Int

Extensions

contains
Link copied to clipboard
inline operator fun IntRange.contains(element: Int?): Boolean

Returns true if this range contains the specified element.

random
Link copied to clipboard
inline fun IntRange.random(): Int

Returns a random element from this range.

fun IntRange.random(random: Random): Int

Returns a random element from this range using the specified source of randomness.

randomOrNull
Link copied to clipboard
inline fun IntRange.randomOrNull(): Int?

Returns a random element from this range, or null if this range is empty.

fun IntRange.randomOrNull(random: Random): Int?

Returns a random element from this range using the specified source of randomness, or null if this range is empty.